{extend name='public/layer_base' /}
{block name='content'}
<div class="layui-fluid content">
    <div class="layui-card">
        <div class="layui-card-body">
            <div class="layui-row">
                <form class="layui-form" method="post" autocomplete="off">
                    <!-- 表单字段区域 -->

                    <div class="layui-form-item">
                        <label for="pid" class="layui-form-label">上级分类</label>
                        <div class="layui-input-block">
                            <div id="cate_parent"></div>

                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="name" class="layui-form-label">名称</label>
                        <div class="layui-input-block">
                            <input id="name" name="name" value="{$data.name|default=''}" placeholder="请输入名称" type="text"
                                class="layui-input">
                        </div>
                    </div>
                   
                    <div class="layui-form-item">
                        <label for="sort" class="layui-form-label">排序</label>
                        <div class="layui-input-inline">
                            <div class="plus-minus">
                                <input id="sort" name="sort" value="{$data.sort|default='50'}" placeholder="请输入排序"
                                    type="number" data-minvalue="1" autocomplete="off" class="layui-input num">
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item layui-hide">
                        <input type="button" lay-submit lay-filter="add-cate-submit" id="add-cate-submit" value="确认">
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<script>

var demo3 = xmSelect.render({
        el: '#cate_parent',
        radio: true,
        name: 'parent_id',
        clickClose: true,
        autoRow: true,
        filterable: true,
        model: {
            label: {
                type: 'text',
                text: {
                    //左边拼接的字符
                    left: '',
                    //右边拼接的字符
                    right: '',
                    //中间的分隔符
                    separator: ', ',
                },
            }
        },
        tree: {
            show: true,
            showFolderIcon: true,
            showLine: true,
            indent: 20,
            strict: false,
            expandedKeys: [-3],
        },
        filterable: true,
        height: 'auto',
        data: function () {
            return JSON.parse('{$select|raw}')
        }
    });

</script>

{/block}